import { registerGridColumnProvider } from '@ibiz-template/runtime';
import { App } from 'vue';
import { withInstall } from '@ibiz-template/vue3-util';
import { GridColumnPluginProvider } from './grid-column.provider';
import GridColumnPlugin from './grid-column';

export const IBizGridColumnPlugin = withInstall(
  GridColumnPlugin,
  function (v: App) {
    // 全局注册表格列插件组件
    v.component(GridColumnPlugin.name, GridColumnPlugin);
    // 全局注册表格列适配器，GRID_COLRENDER是插件类型，R9GridColumnPluginId是插件标识
    registerGridColumnProvider(
      'GRID_COLRENDER_R9GridColumnPluginId',
      () => new GridColumnPluginProvider(),
    );
  },
);

export default IBizGridColumnPlugin;
